//
//  LBAVBaseView.h
//  AFNetworking
//
//  Created by 刘文扬 on 2018/3/14.
//

#import <UIKit/UIKit.h>
#import "LBTILiveManager.h"

@class LBAVBaseView,LBAVButtonItem,LBAVMemberModel;
@protocol LBAVBaseViewSubWindowDelegate<NSObject>

//设置小窗口的大小

-(CGRect)rectForSubWindowInAVView:(LBAVBaseView *)avView identity:(NSString *)identity videoCount:(NSInteger)videoCount videoIndex:(NSInteger)videoIndex isOwnSide:(BOOL)isOwnSide;

@end

@protocol LBAVBaseViewButtonDelegate<NSObject>

//设置界面上的button

-(NSArray<UIButton *> *)listOfButton;


@end

@protocol LBAVBaseViewDelegate<NSObject>

@optional


-(UIButton *)customButton;

/**
 获取这个人的用户信息
 
 @param avView avView
 @param userId userId
 @param completion completion
 */
-(void)avView:(LBAVBaseView *)avView getUserInfoWithUserId:(NSString *)userId completion:(void (^)(LBAVMemberModel *memberModel))completion;



/**
 返回是否是自己方,用来布局
 
 @param avView avView
 @param userId userId
 @return return value
 */
-(BOOL)avView:(LBAVBaseView *)avView isOwnSideForUser:(NSString *)userId;

/**
 获取title
 
 @param avView avView
 @param section section
 @return return value
 */
-(NSString *)avView:(LBAVBaseView *)avView titleForSection:(NSInteger)section;



/**
 topView的高度
 
 @return height
 */
-(CGFloat)heightForTopView;


/**
 add渲染的view之后的代理,现在主要是加入房主标签
 
 @param avView avView
 @param userId userId
 @param renderView renderView
 @param rect rect
 */
-(void)avView:(LBAVBaseView *)avView didAddRenderViewForUser:(NSString *)userId liveRenderView:(ILiveRenderView *)renderView rect:(CGRect)rect;

/**
 有人进入的时候发送的代理
 
 @param avView avView
 @param userId userId
 @param isInData 是否在数组中
 */
-(void)avView:(LBAVBaseView *)avView userEntryRoom:(NSString *)userId isInData:(BOOL)isInData;


/**
 退出房间
 
 @param avView avView
 @param userId userId
 */
-(void)avView:(LBAVBaseView *)avView userQuitRoom:(NSString *)userId;




@end

@interface LBAVBaseView : UIView

/** 房间ID*/
@property(nonatomic,strong)NSString *roomId;

/** 角色*/
@property(nonatomic,assign)LBAVRole role;


/** topView*/
@property(nonatomic,strong)UIView *lb_topView;

/** firstTitleView*/
@property(nonatomic,strong)UIView *firstTitleView;

/** secondTitleView*/
@property(nonatomic,strong)UIView *secondTitleView;

/** 小窗口的代理,如果不设置的话,代理本身是自身类,会按照统一的方式显示小窗,如果需要定制,需要设置代理,实现代理方法*/
@property(nonatomic,weak)id<LBAVBaseViewSubWindowDelegate> subWindowDelegate;

/** 按钮的代理,如果不设置的话,代理本身是自身类,会按照统一的方式显示按钮,如果需要定制,需要设置代理,实现代理方法*/
@property(nonatomic,weak)id<LBAVBaseViewButtonDelegate> buttonDelegate;

@property(nonatomic,weak)id<LBAVBaseViewDelegate> delegate;

/** ownSideMembers,己方成员模型*/
@property(nonatomic,strong)NSMutableArray<LBAVMemberModel *> *ownSideMembers;

/** otherSideMembers,对方成员模型*/
@property(nonatomic,strong)NSMutableArray<LBAVMemberModel *> *otherSideMembers;

-(instancetype)initWithFrame:(CGRect)frame subWindowDelegate:(id<LBAVBaseViewSubWindowDelegate>)subWindowDelegate buttonDelegate:(id<LBAVBaseViewButtonDelegate>)buttonDelegate;

//对于主播是创建房间,对于LBAVRoleInteractGuest是连麦,对于普通游客是看直播
-(void)startDisplay;

-(instancetype)initWithFrame:(CGRect)frame delegate:(id<LBAVBaseViewDelegate>)delegate;



/** playView*/
@property(nonatomic,strong)UIView *playView;

/**
 名字是collectionView,使用这个之前要设置数组
 */
-(void)reloadCollectionView;

-(UIButton *)defaultCameraButton;

-(UIButton *)defaultVoiceButton;

-(UIButton *)defaultScreenButton;

-(UIButton *)defaultSwitchButton;

-(UIButton *)defaultTextButton;

-(UIButton *)defaultMicButton;

@end


@interface LBAVMemberModel : NSObject

/** userId*/
@property(nonatomic,copy)NSString *userId;

/** userName*/
@property(nonatomic,copy)NSString *userName;

@end

@interface LBAVRenderModel : NSObject

-(instancetype)initWithIdentity:(NSString *)identity videoCount:(NSInteger)videoCount videoIndex:(NSInteger)videoIndex isOwnSide:(BOOL)isOwnSide;


@property(nonatomic,copy)NSString *identity;

@property(nonatomic,assign)NSInteger videoCount;

@property(nonatomic,assign)NSInteger videoIndex;

@property(nonatomic,assign)NSInteger isOwnSide;

@end


